//use for 8 switch
int inputPin = A0;
long debouncetime = 100;
int key =0;
int lastkey = 0;
int delaytime = 250;
void setup() {
  pinMode(inputPin,INPUT);
  Serial.begin(9600);
  
}

void loop() {
 int reading = analogRead(inputPin);
 delay(debouncetime);
 int reading2 = analogRead(inputPin);
 if( reading2 - reading ==0)
 {
  switch(reading2)
  {
  case 910:
  case 911:
  key = 1;
  break;
  case 796:
  case 795:
  key = 2;
  break;
  case 683:
  case 682:
  key = 3;
  break;
  case 569:
  case 568:
  key = 4;
  break;
  case 455:
  case 454:
  key = 5;
  break;
  case 341:
  key = 6;
  break;
  case 226:
  case 227:
  key = 7;
  break;
  case 112:
  case 111:
  key = 8;
  break;
  }
  if(key !=0)
  {
  Serial.println(key);
  key = 0;
  delay(delaytime);
  }
 }
}
